package com.emergency.assist.controller;

import com.emergency.assist.domain.RouteOptimal;
import com.emergency.assist.service.RouteService;
import com.emergency.common.entity.Result;
import com.emergency.common.entity.StatusCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/*
Created by lijie on 2019/10/17
.*/
@RestController
@RequestMapping("/route")
@Api(value="路线规划类",description = "包括抢修路线，安全进入路线，最优撤离路线等路线辅助规划")
public class RouteController {

    @Autowired
    private RouteService routeService;

    @ApiOperation(value = "路线规划接口" ,  notes="按照路线矩阵数据，计算分析路线")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "data", value = "路线矩阵数据", required = true, paramType = "query", dataType = "String"),
    })
    @RequestMapping(value = "planning")
    public Result planning(long scenarID,String origin,String destination){

        RouteOptimal excellentRoute=routeService.routePlanning(scenarID,origin,destination);

        return new Result(true, StatusCode.OK,  "分析成功", excellentRoute);
    }

    @RequestMapping(value = "import")
    public Result importData(String origin,String destination,int tactics){

       routeService.importData(origin,destination,tactics);

        return new Result(true, StatusCode.OK,  "分析成功", "");
    }
}

